/*-------------------------------------------------------------------------
 * CLR版本:     4.0.30319.42000
 * 创建人:      song
 * 创建时间：   2024/4/9 17:56:20
 * 功 能：      Texture 绘制器
 *-------------------------------------------------------------------------*/

#if UNITY_EDITOR
namespace SCore.Editor.SShaderDraw
{
    using System.Collections.Generic;
    using UnityEditor;
    using UnityEngine;

    public class STextureProp : SPropSuperBase<Texture>
    {
        public override void Draw(float space, float BtnSize = 40)
        {
            if (this.props.ContainsKey(this.name))
            {
                MaterialProperty prop = base.props[base.name];
                EditorGUILayout.BeginHorizontal();
                GUILayout.Space(space);
                materialEditor.TextureProperty(prop, this.lable.text);
                GUILayout.EndHorizontal();
            }
        }

        protected override Texture getValue()
        {
            return this.props[this.name].textureValue;
        }

        protected override void ResetDefaultValue()
        {
            this.props[this.name].textureValue = defaultValue;
        }

        protected override void setValue(Texture value)
        {
            this.props[this.name].textureValue = value;
        }

        public STextureProp(string name, GUIContent lable, MaterialEditor materialEditor,
            Dictionary<string, MaterialProperty> props, Texture defaultValue) :
            base(name, lable, materialEditor, props, defaultValue)
        {
        }
    }
}
#endif